home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / PDCUR24B.ZIP / include / curspriv.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  22.4 KB  |  594 lines

  1. /*
  2. ***************************************************************************
  3. * This file comprises part of PDCurses. PDCurses is Public Domain software.
  4. * You may use this code for whatever purposes you desire. This software
  5. * is provided AS IS with NO WARRANTY whatsoever.
  6. * Should this software be used in another application, an acknowledgement
  7. * that PDCurses code is used would be appreciated, but is not mandatory.
  8. *
  9. * Any changes which you make to this software which may improve or enhance
  10. * it, should be forwarded to the current maintainer for the benefit of 
  11. * other users.
  12. *
  13. * The only restriction placed on this code is that no distribution of
  14. * modified PDCurses code be made under the PDCurses name, by anyone
  15. * other than the current maintainer.
  16. * See the file maintain.er for details of the current maintainer.
  17. ***************************************************************************
  18. */
  19. /*
  20. $Id$
  21. */
  22. /*
  23. *
  24. *                          CURSPRIV.H
  25. *
  26. * Header file for definitions and declarations for the
  27. * PDCurses package. These definitions should not be generally
  28. * accessible to programmers, but are provided if the applications
  29. * programmer decides to make the decision in favor of speed on a
  30. * PC over portability.
  31. *
  32. * Revision History:
  33. * Frotz 1.5Beta 900714  Added many levels of compiler support.
  34. *                       Added mixed prototypes for all "internal" routines.
  35. *                       Removed all assembly language.  Added EGA/VGA
  36. *                       support.  Converted all #ifdef to #if in all
  37. *                       modules except CURSES.H and CURSPRIV.H.
  38. *                       Always include ASSERT.H.  Added support for an
  39. *                       external malloc(), calloc() and free().
  40. *                       Added support for FAST_VIDEO (direct-memory writes).
  41. *                       Added various memory model support (for FAST_VIDEO).
  42. *                       Added much of the December 1988 X/Open Curses
  43. *                       specification.
  44. * bl    1.3     881005  All modules lint-checked with MSC '-W3' and turbo'C'
  45. *                       '-w -w-pro' switches.
  46. * bl    1.2     881002  Support (by #ifdef UCMASM) for uppercase-only
  47. *                       assembly routine names. If UCMASM if defined,
  48. *                       all assembler names are #defined as upper case.
  49. *                       Not needed if you do "MASM /MX. Also missing
  50. *                       declaration of cursesscroll(). Fixes thanks to
  51. *                       N.D. Pentcheff
  52. * bl    1.1     880306  Add _chadd() for raw output routines.
  53. * bl    1.0     870515  Release.
  54. *
  55. */
  56.  
  57. #ifndef __CURSES_INTERNALS__
  58. #define __CURSES_INTERNALS__
  59.  
  60. /* Always include... */
  61. #include <assert.h>
  62.  
  63. #if defined(HAVE_STDARG_H) && defined(HAVE_PROTO)
  64. #  include <stdarg.h>
  65. #  define HAVE_STDARG_H_HAVE_PROTO
  66. #else
  67. #  include <varargs.h>
  68. #endif
  69.  
  70. /*----------------------------------------------------------------------
  71. *       MEMORY MODEL SUPPORT:
  72. *
  73. *       MODELS
  74. *               TINY            cs,ds,ss all in 1 segment (not enough memory!)
  75. *               SMALL           cs:1 segment,           ds:1 segment
  76. *               MEDIUM          cs:many segments        ds:1 segment
  77. *               COMPACT         cs:1 segment,           ds:many segments
  78. *               LARGE           cs:many segments        ds:many segments
  79. *               HUGE            cs:many segments        ds:segments > 64K
  80. */
  81. #ifdef  __TINY__
  82. #  define SMALL 1
  83. #endif
  84. #ifdef  __SMALL__
  85. #  define SMALL 1
  86. #endif
  87. #ifdef  __MEDIUM__
  88. #  define MEDIUM 1
  89. #endif
  90. #ifdef  __COMPACT__
  91. #  define COMPACT 1
  92. #endif
  93. #ifdef  __LARGE__
  94. #  define LARGE 1
  95. #endif
  96. #ifdef  __HUGE__
  97. #  define HUGE 1
  98. #endif
  99.  
  100.  
  101. /*----------------------------------------------------------------------
  102. *       OPERATING SYSTEM SUPPORT:
  103. *
  104. *               DOS             The one we all know and love:-}
  105. *               OS/2            The new kid on the block.
  106. *               FLEXOS          A Real-time, protected-mode OS from
  107. *                               Digital Research, Inc.
  108. *                (AKA, the 4680 from IBM...)
  109. */
  110.  
  111. /*----------------------------------------*/
  112. #ifdef  DOS
  113. #  define FAST_VIDEO 1          /* We can write directly to the screen. */
  114. #  ifdef NDP
  115.      typedef union REGS16 Regs;
  116. #  else
  117.      typedef union REGS Regs;
  118. #  endif
  119.    extern Regs regs;
  120. #  ifdef GO32                           /* Note: works only in plain DOS... */
  121. #    if DJGPP == 2
  122. #      define _FAR_POINTER(s,o)        ((((int)(s))<<4) + ((int)(o)))
  123. #    else
  124. #      define _FAR_POINTER(s,o)        (0xe0000000 + (((int)(s))<<4) + ((int)(o)))
  125. #    endif
  126. #    define _FP_SEGMENT(p)        (unsigned short)((((long)fp) >> 4) & 0xffff)
  127. #    define _FP_OFFSET(p)        ((unsigned short)fp & 0x000f)
  128. #  else
  129. #    ifdef __TURBOC__
  130. #      define _FAR_POINTER(s,o)    MK_FP(s,o)
  131. #    else
  132. #      if defined(NDP)
  133. #        define _FAR_POINTER(s,o)    ((((int)(s))<<4) + ((int)(o)))
  134. #      else
  135. #        if defined(WATCOMC) && defined(__FLAT__)
  136. #          define _FAR_POINTER(s,o)    ((((int)(s))<<4) + ((int)(o)))
  137. #        else
  138. #          define _FAR_POINTER(s,o)    (((long)s << 16) | (long)o)
  139. #        endif
  140. #      endif
  141. #    endif
  142. #    define _FP_SEGMENT(p)        (unsigned short)(((long)fp) >> 4)
  143. #    define _FP_OFFSET(p)        ((unsigned short)fp & 0x000f)
  144. #  endif
  145.  
  146. #  ifdef GO32
  147.      unsigned char getdosmembyte (int offs);    /* see: private\_dosmem.c */
  148.      unsigned short getdosmemword (int offs);
  149.      void setdosmembyte (int offs, unsigned char b);
  150.      void setdosmemword (int offs, unsigned short w);
  151. #  else
  152. #    if SMALL || MEDIUM || MSC
  153. #      define getdosmembyte(offs)    (*((unsigned char far *) _FAR_POINTER(0,offs)))
  154. #      define getdosmemword(offs)    (*((unsigned short far *) _FAR_POINTER(0,offs)))
  155. #      define setdosmembyte(offs,x)  (*((unsigned char far *) _FAR_POINTER(0,offs)) = (x))
  156. #      define setdosmemword(offs,x)  (*((unsigned short far *) _FAR_POINTER(0,offs)) = (x))
  157. #    else
  158. #      define getdosmembyte(offs)    (*((unsigned char *) _FAR_POINTER(0,offs)))
  159. #      define getdosmemword(offs)    (*((unsigned short *) _FAR_POINTER(0,offs)))
  160. #      define setdosmembyte(offs,x)  (*((unsigned char *) _FAR_POINTER(0,offs)) = (x))
  161. #      define setdosmemword(offs,x)  (*((unsigned short *) _FAR_POINTER(0,offs)) = (x))
  162. #    endif
  163. #  endif
  164. #endif
  165.  
  166. /*----------------------------------------*/
  167. #ifdef  FLEXOS
  168. #  define FAST_VIDEO 1          /* We can use scopy()   */
  169. #  define GMODE  0 /* KLUDGE ALERT!
  170.                    * GMODE == 0 defines character mode structures in FLEXTAB.H.
  171.                    * GMODE == 1 defines graphics  mode structures in FLEXTAB.H.
  172.                    */
  173. #include <flextab.h>
  174. extern VIRCON vir;
  175. #endif
  176.  
  177.  
  178.  
  179.  
  180. /*----------------------------------------------------------------------
  181. *       MALLOC DEBUGGING SUPPORT:
  182. *
  183. *       Set EMALLOC and EMALLOC_MAGIC in order to use your private
  184. *       versions of malloc(), calloc(), and free().  This can help,
  185. *       but not solve, your malloc problems when debugging...
  186. *
  187. */
  188. #if defined(INTERNAL) || defined(CURSES_LIBRARY)
  189. #  define EMALLOC 0             /* Enable/Disable External Malloc       */
  190. #  define EMALLOC_MAGIC  0x0C0C /* Our magic indicator that we should   */
  191.                                 /* use our external malloc rather than  */
  192.                                 /* the runtime's malloc.                */
  193. #else
  194. #  define EMALLOC 0             /* Disable External Malloc            */
  195. #endif
  196.  
  197.  
  198. /*----------------------------------------------------------------------*/
  199. /* window properties */
  200. #define _SUBWIN         0x01    /* window is a subwindow            */
  201. #define _ENDLINE        0x02    /* last winline is last screen line */
  202. #define _FULLWIN        0x04    /* window fills screen              */
  203. #define _SCROLLWIN      0x08    /* window lwr rgt is screen lwr rgt */
  204. #define _PAD            0x10    /* X/Open Pad.                      */
  205. #define _SUBPAD         0x20    /* X/Open subpad.                   */
  206.  
  207.  
  208.  
  209.  
  210. /*----------------------------------------------------------------------*/
  211. /* Miscellaneous */
  212. #define _INBUFSIZ       512     /* size of terminal input buffer */
  213. #define _NO_CHANGE      -1      /* flags line edge unchanged     */
  214.  
  215.  
  216.  
  217.  
  218. /* @@@ THESE SHOULD BE INDIVIDUAL FUNCTIONS, NOT MACROS! */
  219. #define _BCHAR          0x03    /* Break char        (^C)         */
  220. #define _ECHAR          0x08    /* Erase char        (^H)         */
  221. #define _DWCHAR         0x17    /* Delete Word char (^W)         */
  222. #define _DLCHAR         0x15    /* Delete Line char (^U)         */
  223. #define _GOCHAR         0x11    /* ^Q character                  */
  224. #define _PRINTCHAR      0x10    /* ^P character                  */
  225. #define _STOPCHAR       0x13    /* ^S character                  */
  226. #define  NUNGETCH       20      /* max # chars to ungetch()      */
  227.  
  228.  
  229.  
  230.  
  231. /* Setmode stuff */
  232. struct cttyset
  233. {
  234.     bool    been_set;
  235.     SCREEN    saved;
  236. };
  237.  
  238. extern struct cttyset c_sh_tty;         /* tty modes for shell_mode */
  239. extern struct cttyset c_pr_tty;         /* tty modes for prog_mode  */
  240. extern struct cttyset c_save_tty;
  241. extern struct cttyset c_save_trm;
  242.  
  243. /* Printscan stuff */
  244. extern char c_printscanbuf[];           /* buffer used during I/O */
  245.  
  246. /* tracing flag */
  247. extern bool trace_on;
  248.  
  249. /* Strget stuff */
  250. extern char*    c_strbeg;
  251.  
  252. /* doupdate stuff */
  253. extern WINDOW*  twin;                   /* used by many routines */
  254.  
  255.  
  256. /* Monitor (terminal) type information */
  257. #define _NONE           0x00
  258. #define _MDA            0x01
  259. #define _CGA            0x02
  260. #define _EGACOLOR       0x04
  261. #define _EGAMONO        0x05
  262. #define _VGACOLOR       0x07
  263. #define _VGAMONO        0x08
  264. #define _MCGACOLOR      0x0a
  265. #define _MCGAMONO       0x0b
  266. #define _FLEXOS         0x20            /* A Flexos console */
  267. #define _MDS_GENIUS     0x30
  268. #define _UNIX_COLOR     0x40
  269. #define _UNIX_MONO      0x41
  270.  
  271. /* Text-mode font size information */
  272. #define _FONT8  8
  273. #define _FONT14 14
  274. #define _FONT15 15              /* GENIUS */
  275. #define _FONT16 16
  276.  
  277.  
  278. /*----------------------------------------------------------------------
  279. *       ANSI C prototypes.  Be sure that your compiler conditional
  280. *       compilation definitions above define HAVE_PROTO if your compiler 
  281. *       supports prototypes.
  282. */
  283. #ifdef     HAVE_PROTO
  284. void            PDC_beep( void );
  285. int             PDC_backchar( WINDOW*, char*, int* );
  286. bool            PDC_breakout( void );
  287. int             PDC_chadd( WINDOW*, chtype, bool, bool );
  288. bool            PDC_check_bios_key( void );
  289. int             PDC_chg_attr( WINDOW*, chtype, int, int, int, int );
  290. int             PDC_chins( WINDOW*, chtype, bool );
  291. int             PDC_clr_scrn( WINDOW* );
  292. int             PDC_clr_update( WINDOW* );
  293. int             PDC_copy_win( WINDOW *,WINDOW *,int,int,int,int,int,int,int,int,bool );
  294. int             PDC_cursor_off( void );
  295. int             PDC_cursor_on( void );
  296. int             PDC_curs_set( int );
  297. int             PDC_fix_cursor( int );
  298. int             PDC_gattr( void );
  299. int             PDC_get_bios_key( void );
  300. int             PDC_get_columns( void );
  301. bool            PDC_get_ctrl_break( void );
  302. int             PDC_get_cur_col( void );
  303. int             PDC_get_cur_row( void );
  304. int             PDC_get_cursor_pos( int*, int* );
  305. int             PDC_get_cursor_mode( void );
  306. int             PDC_get_font( void );
  307. int             PDC_get_rows( void );
  308. int             PDC_get_buffer_rows( void );
  309. int             PDC_gotoxy( int, int );
  310. int             PDC_init_atrtab(void);
  311. WINDOW*         PDC_makenew( int, int, int, int );
  312. int             PDC_mouse_in_slk( int, int );
  313. int             PDC_newline( WINDOW*, int );
  314. int             PDC_print( int, int, int );
  315. int             PDC_putc( chtype, chtype );
  316. int             PDC_putchar( chtype );
  317. int             PDC_putctty( chtype, chtype );
  318. int             PDC_rawgetch( void );
  319. int             PDC_reset_prog_mode( void );
  320. int             PDC_reset_shell_mode( void );
  321. int             PDC_resize_screen( int, int );
  322. int             PDC_sanity_check( int );
  323. int             PDC_scr_close( void );
  324. int             PDC_scr_open( SCREEN*, bool );
  325. int             PDC_scroll( int, int, int, int, int, chtype );
  326. int             PDC_set_80x25( void );
  327. int             PDC_set_ctrl_break( bool );
  328. int             PDC_set_cursor_mode( int, int );
  329. int             PDC_set_font( int );
  330. int             PDC_set_rows( int );
  331. int             PDC_split_plane( WINDOW*, char*, char*, int, int, int, int );
  332. void            PDC_sync( WINDOW * );
  333. int             PDC_sysgetch( void );
  334. bool            PDC_transform_line( int );
  335. void            PDC_usleep( long );
  336. int             PDC_validchar( int );
  337. int             PDC_vsscanf( char *, const char *, va_list);
  338.  
  339. int             PDC_query_adapter_type( void );
  340. int             PDC_get_scrn_mode( void );
  341. void            PDC_slk_calc( void );
  342.  
  343.  
  344. # if defined( OS2 ) && !defined( EMXVIDEO )
  345. int             PDC_set_scrn_mode( VIOMODEINFO);
  346. bool            PDC_scrn_modes_equal (VIOMODEINFO, VIOMODEINFO);
  347. # else
  348. int             PDC_set_scrn_mode( int );
  349. bool            PDC_scrn_modes_equal (int, int);
  350. # endif
  351.  
  352. # ifdef  FLEXOS
  353. int             PDC_flexos_8bitmode( void );
  354. int             PDC_flexos_16bitmode( void );
  355. char*           PDC_flexos_gname( void );
  356. # endif
  357.  
  358. # ifdef UNIX
  359. int             PDC_kbhit(void);
  360. int             PDC_setup_keys(void);
  361. # endif
  362.  
  363. # ifdef WIN32
  364. void            PDC_doupdate(void);
  365. # endif
  366.  
  367. # if defined (XCURSES)
  368. int             XCurses_redraw_curscr(void);
  369. int             XCurses_display_cursor(int,int,int,int);
  370. int             XCurses_rawgetch(void);
  371. bool            XCurses_kbhit(void);
  372. int             XCurses_get_input_fd(void);
  373. int             XCursesInstruct(int);
  374. int             XCursesInstructAndWait(int);
  375. int             XCurses_transform_line(chtype*, int , int , int );
  376. int             XCursesInitscr(char *,int, char **);
  377. int             XCursesEndwin(void);
  378. void            XCursesCleanupCursesProcess(int);
  379. int             XCursesResizeScreen( int, int );
  380. int             XCurses_get_cols(void);
  381. int             XCurses_get_rows(void);
  382. int             XCurses_refresh_scrollbar(void);
  383. void            XCurses_set_title(char *);
  384. void            XCurses_set_title(char *);
  385. int             XCurses_getclipboard( char **, long * );
  386. int             XCurses_setclipboard( char *, long );
  387. unsigned long   XCurses_get_key_modifiers( void );
  388. # endif
  389.  
  390. # ifdef PDCDEBUG
  391. void            PDC_debug( char*,... );
  392. # endif
  393.  
  394. # ifdef  REGISTERWINDOWS
  395. bool            PDC_inswin( WINDOW*, WINDOW* );
  396. int             PDC_addtail( WINDOW* );
  397. int             PDC_addwin( WINDOW*, WINDOW* );
  398. int             PDC_rmwin( WINDOW* );
  399. WINDS*          PDC_findwin( WINDOW* );
  400. # endif
  401.  
  402. #else
  403.  
  404. void            PDC_beep( /* void */ );
  405. int             PDC_backchar( /* WINDOW*, char*, int* */ );
  406. bool            PDC_breakout( /* void */ );
  407. int             PDC_chadd( /* WINDOW*, chtype, bool, bool */ );
  408. bool            PDC_check_bios_key( /* void */ );
  409. int             PDC_chg_attr( /* WINDOW*, chtype, int, int, int, int */ );
  410. int             PDC_chins( /* WINDOW*, chtype, bool */ );
  411. int             PDC_clr_scrn( /* WINDOW* */ );
  412. int             PDC_clr_update( /* WINDOW* */ );
  413. int             PDC_copy_win( /* WINDOW *,WINDOW *,int,int,int,int,int,int,int,int,bool */ );
  414. int             PDC_cursor_off( /* void */ );
  415. int             PDC_cursor_on( /* void */ );
  416. int             PDC_curs_set( /* int */ );
  417. int             PDC_fix_cursor( /* int */ );
  418. int             PDC_gattr( /* void */ );
  419. int             PDC_get_bios_key( /* void */ );
  420. int             PDC_get_columns( /* void */ );
  421. bool            PDC_get_ctrl_break( /* void */ );
  422. int             PDC_get_cur_col( /* void */ );
  423. int             PDC_get_cur_row( /* void */ );
  424. int             PDC_get_cursor_pos( /* int*, int* */ );
  425. int             PDC_get_cursor_mode( /* void */ );
  426. int             PDC_get_font( /* void */ );
  427. int             PDC_get_rows( /* void */ );
  428. int             PDC_get_buffer_rows( /* void */ );
  429. int             PDC_gotoxy( /* int, int */ );
  430. int             PDC_init_atrtab( /*void*/ );
  431. WINDOW*         PDC_makenew( /* int, int, int, int */ );
  432. int             PDC_mouse_in_slk(/* int, int */ );
  433. int             PDC_newline( /* WINDOW*, int */ );
  434. int             PDC_print( /* int, int, int */ );
  435. int             PDC_putc( /* chtype, chtype */ );
  436. int             PDC_putchar( /* chtype */ );
  437. int             PDC_putctty( /* chtype, chtype */ );
  438. int             PDC_rawgetch( /* void */ );
  439. int             PDC_reset_prog_mode( /* void */ );
  440. int             PDC_reset_shell_mode( /* void */ );
  441. int             PDC_resize_screen( /* int, int */ );
  442. int             PDC_sanity_check( /* int */ );
  443. int             PDC_scr_close( /* void */ );
  444. int             PDC_scr_open( /* SCREEN*, bool */ );
  445. int             PDC_scroll( /* int, int, int, int, int, chtype */ );
  446. int             PDC_set_80x25( /* void */ );
  447. int             PDC_set_ctrl_break( /* bool */ );
  448. int             PDC_set_cursor_mode( /* int, int */ );
  449. int             PDC_set_font( /* int */ );
  450. int             PDC_set_rows( /* int */ );
  451. int             PDC_split_plane( /* WINDOW*, char*, char*, int, int, int, int */ );
  452. void            PDC_sync( /* WINDOW * */ );
  453. int             PDC_sysgetch( /* void */ );
  454. bool            PDC_transform_line( /* int */ );
  455. void            PDC_usleep( /* long */ );
  456. int             PDC_validchar( /* int */ );
  457. int             PDC_vsscanf( /* char *, const char *, ... */);
  458.  
  459. int             PDC_query_adapter_type( /* void */ );
  460. int             PDC_get_scrn_mode( /* void */ );
  461. void            PDC_slk_calc( /* void */ );
  462.  
  463.  
  464. # if defined( OS2 ) && !defined( EMXVIDEO )
  465. int             PDC_set_scrn_mode( /* VIOMODEINFO*/ );
  466. bool            PDC_scrn_modes_equal ( /*VIOMODEINFO, VIOMODEINFO*/ );
  467. # else
  468. int             PDC_set_scrn_mode( /* int */ );
  469. bool            PDC_scrn_modes_equal ( /*int, int*/ );
  470. # endif
  471.  
  472. # ifdef  FLEXOS
  473. int             PDC_flexos_8bitmode( /* void */ );
  474. int             PDC_flexos_16bitmode( /* void */ );
  475. char*           PDC_flexos_gname( /* void */ );
  476. # endif
  477.  
  478. # ifdef UNIX
  479. int             PDC_kbhit( /*void*/ );
  480. int             PDC_setup_keys( /*void*/ );
  481. # endif
  482.  
  483. # ifdef WIN32
  484. void            PDC_doupdate( /*void*/ );
  485. # endif
  486.  
  487. # if defined ( XCURSES )
  488. int             XCurses_redraw_curscr( /*void*/ );
  489. int             XCurses_display_cursor( /*int,int,int,int*/ );
  490. int             XCurses_rawgetch( /*void*/ );
  491. bool            XCurses_kbhit( /*void*/ );
  492. int             XCurses_get_input_fd( /*void*/ );
  493. int             XCursesInstruct( /*int*/ );
  494. int             XCursesInstructAndWait( /*void*/ );
  495. int             XCurses_transform_line( /*chtype*, int , int , int */ );
  496. int             XCursesInitscr( /* char *, int, char ** */ );
  497. int             XCursesEndwin( /*void*/ );
  498. void            XCursesCleanupCursesProcess(/* int */);
  499. int             XCursesResizeScreen( /* int, int */ );
  500. int             XCurses_get_cols(/* void */);
  501. int             XCurses_get_rows(/* void */);
  502. int             XCurses_refresh_scrollbar( /* void */ );
  503. void            XCurses_set_title(/* char * */ );
  504. int             XCurses_getclipboard( /* char **, long * */ );
  505. int             XCurses_setclipboard( /* char *, long */ );
  506. unsigned long   XCurses_get_key_modifiers( /* void */ );
  507. # endif
  508.  
  509. # ifdef PDCDEBUG
  510. void            PDC_debug( /* char*,... */ );
  511. # endif
  512.  
  513. # ifdef  REGISTERWINDOWS
  514. bool            PDC_inswin( /* WINDOW*, WINDOW* */ );
  515. int             PDC_addtail( /* WINDOW* */ );
  516. int             PDC_addwin( /* WINDOW*, WINDOW* */ );
  517. int             PDC_rmwin( /* WINDOW* */ );
  518. WINDS*          PDC_findwin( /* WINDOW* */ );
  519. # endif
  520. #endif
  521.  
  522. #define PDC_COLORS           8
  523. #define PDC_COLOR_PAIRS     64
  524.  
  525. #if defined(CHTYPE_LONG)
  526. #  define PDC_OFFSET       32
  527. #  define MAX_ATRTAB      ((PDC_COLOR_PAIRS+1)*PDC_OFFSET)
  528. /* internal macros for attributes */
  529. #  define chtype_attr(ch)  (atrtab[((ch >> 19) & 0xFFFF)] << 8)
  530. #else
  531. #  define PDC_OFFSET        8
  532. #  define MAX_ATRTAB      272
  533. /* internal macros for attributes */
  534. #  define chtype_attr(ch)  ((atrtab[((ch >> 8) & 0xFF)] << 8) & A_ATTRIBUTES)
  535. #endif
  536. /*
  537.  * Internal mouse handling macros
  538.  */
  539. #define TRAPPED_MOUSE_X_POS            (Trapped_Mouse_status.x)
  540. #define TRAPPED_MOUSE_Y_POS            (Trapped_Mouse_status.y)
  541. #define TRAPPED_A_BUTTON_CHANGED       (Trapped_Mouse_status.changes & 7)
  542. #define TRAPPED_MOUSE_MOVED            (Trapped_Mouse_status.changes & 8)
  543. #define TRAPPED_MOUSE_POS_REPORT       (Trapped_Mouse_status.changes & 16)
  544. #define TRAPPED_BUTTON_CHANGED(x)      (Trapped_Mouse_status.changes & (1 << ((x) - 1)))
  545. #define TRAPPED_BUTTON_STATUS(x)       (Trapped_Mouse_status.button[(x)-1])
  546.  
  547. #define ACTUAL_MOUSE_X_POS            (Actual_Mouse_status.x)
  548. #define ACTUAL_MOUSE_Y_POS            (Actual_Mouse_status.y)
  549. #define ACTUAL_A_BUTTON_CHANGED       (Actual_Mouse_status.changes & 7)
  550. #define ACTUAL_MOUSE_MOVED            (Actual_Mouse_status.changes & 8)
  551. #define ACTUAL_MOUSE_POS_REPORT       (Actual_Mouse_status.changes & 16)
  552. #define ACTUAL_BUTTON_CHANGED(x)      (Actual_Mouse_status.changes & (1 << ((x) - 1)))
  553. #define ACTUAL_BUTTON_STATUS(x)       (Actual_Mouse_status.button[(x)-1])
  554.  
  555. #define TEMP_MOUSE_X_POS            (Temp_Mouse_status.x)
  556. #define TEMP_MOUSE_Y_POS            (Temp_Mouse_status.y)
  557. #define TEMP_A_BUTTON_CHANGED       (Temp_Mouse_status.changes & 7)
  558. #define TEMP_MOUSE_MOVED            (Temp_Mouse_status.changes & 8)
  559. #define TEMP_MOUSE_POS_REPORT       (Temp_Mouse_status.changes & 16)
  560. #define TEMP_BUTTON_CHANGED(x)      (Temp_Mouse_status.changes & (1 << ((x) - 1)))
  561. #define TEMP_BUTTON_STATUS(x)       (Temp_Mouse_status.button[(x)-1])
  562.  
  563. #if defined(XCURSES)
  564. #define CURSES_EXIT                999999
  565. #define CURSES_REFRESH             999998
  566. #define CURSES_CHILD               999997
  567. #define CURSES_CURSOR              999996
  568. #define CURSES_CONTINUE            999995
  569. #define CURSES_BELL                999994
  570. #define CURSES_FLASH               999993
  571. #define CURSES_CLEAR               999992
  572. #define CURSES_RESIZE              999991
  573. #define CURSES_REFRESH_SCROLLBAR   999990
  574. #define CURSES_TITLE               999989
  575. #define CURSES_GET_SELECTION       999988
  576. #define CURSES_SET_SELECTION       999987
  577.  
  578. #define XCURSCR_Y_SIZE      (XCursesLINES*XCursesCOLS*sizeof(chtype))
  579. #define XCURSCR_FLAG_SIZE   (XCursesLINES*sizeof(int))
  580. #define XCURSCR_START_SIZE  (XCursesLINES*sizeof(int))
  581. #define XCURSCR_LENGTH_SIZE (XCursesLINES*sizeof(int))
  582. #define XCURSCR_ATRTAB_SIZE (MAX_ATRTAB*sizeof(unsigned char))
  583. #define XCURSCR_SIZE        (XCURSCR_FLAG_SIZE+XCURSCR_START_SIZE+XCURSCR_LENGTH_SIZE+XCURSCR_Y_SIZE+XCURSCR_ATRTAB_SIZE)
  584.  
  585. #define XCURSCR_Y_OFF(y)    ((y)*XCursesCOLS*(sizeof(chtype)))
  586. #define XCURSCR_FLAG_OFF    (XCURSCR_Y_OFF(0)+XCURSCR_Y_SIZE)
  587. #define XCURSCR_START_OFF   (XCURSCR_FLAG_OFF+XCURSCR_FLAG_SIZE)
  588. #define XCURSCR_LENGTH_OFF  (XCURSCR_START_OFF+XCURSCR_START_SIZE)
  589. #define XCURSCR_ATRTAB_OFF  (XCURSCR_LENGTH_OFF+XCURSCR_LENGTH_SIZE)
  590. #endif
  591.  
  592. #endif /* __CURSES_INTERNALS__*/
  593.